using System;

class MathExpression
{
    static void Main(string[] args)
    {
		byte a = byte.Parse(Console.ReadLine());
		byte b = byte.Parse(Console.ReadLine());
		byte c = byte.Parse(Console.ReadLine());
		byte d = byte.Parse(Console.ReadLine());
		byte e = byte.Parse(Console.ReadLine());
		for(int number=1; number<Math.Pow(50,5);number++)
		{
			int counter = 0;
			if(number % a == 0)
			{
				counter++;
			}
			if(number % b == 0)
			{
				counter++;
			}
			if(number % c == 0)
			{
				counter++;
			}
			if(number % d == 0)
			{
				counter++;
			}
			if(number % e == 0)
			{
				counter++;
			}
			if(counter == 3 || counter > 3)
			{
				Console.WriteLine(number);
				return;
			}
		}
	}
}